package com.develop.web.in;


import com.develop.data.loan.model.LoanContract;
import com.develop.data.loan.model.LoanInstallment;
import com.develop.web.in.service.LoanInstallmentBudgetHubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class LoanInstallmentBudgetController {

    @Autowired
    LoanInstallmentBudgetHubService loanInstallmentBudgetHubService;

    @PostMapping(path = "/v1/interestBudget/preview", consumes = {MediaType.APPLICATION_JSON_VALUE})
    @ResponseStatus(HttpStatus.OK)
    List<LoanInstallment> preview(@RequestBody List<LoanInstallment> items) {
        return loanInstallmentBudgetHubService.batchPreview(items);
    }

    @PostMapping(path = "/v1/interestBudget/execute", consumes = {MediaType.APPLICATION_JSON_VALUE})
    @ResponseStatus(HttpStatus.OK)
    List<LoanContract> execute(@RequestBody List<LoanInstallment> items) {
        return null;
    }

}
